<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Fornecedor</title>
        <%@include file="../../_include/header.jsp"%>
    </head>
    <style type="text/css"><!--@import url("../../_css/style.css");--></style>
    <body>
        <f:view>
            <t:saveState id="_bean" value="#{FornecedorBean}" />
            <rich:panel>
                <f:facet name="header">
                    <h:outputText value="Fornecedor"/>
                </f:facet>
                <a4j:form id="frmFornecedor" status="modalStatus">
                    <h:inputHidden value="#{FornecedorBean.id}" id="id"/>
                    <h:panelGrid columns="3">

                        <h:outputLabel value="Razão Social *" for="razaoSocial"/>
                        <h:inputText value="#{FornecedorBean.razaoSocial}" id="razaoSocial" required="true" maxlength="60" style="width:400px;" requiredMessage="Campo Requerido."/>
                        <rich:message for="razaoSocial" style="color:red;"/>

                        <h:outputLabel value="Fantasia" for="fantasia"/>
                        <h:inputText value="#{FornecedorBean.fantasia}" id="fantasia" required="false" maxlength="60" style="width:400px;" requiredMessage="Campo Requerido."/>
                        <rich:message for="fantasia" style="color:red;"/>

                        <h:outputLabel value="CNPJ" for="cnpj"/>
                        <h:inputText value="#{FornecedorBean.cnpj}" id="cnpj" required="false" maxlength="14" style="width:100px;" requiredMessage="Campo Requerido." styleClass="cnpj"/>
                        <rich:message for="cnpj" style="color:red;"/>

                        <h:outputLabel value="Endereço" for="endereco"/>
                        <h:inputText value="#{FornecedorBean.endereco}" id="endereco" required="false" maxlength="60" style="width:400px;" requiredMessage="Campo Requerido."/>
                        <rich:message for="endereco" style="color:red;"/>

                        <h:outputLabel value="Número" for="numero"/>
                        <h:inputText value="#{FornecedorBean.numero}" id="numero" required="false" maxlength="11" style="width:100px;" requiredMessage="Campo Requerido."/>
                        <rich:message for="numero" style="color:red;"/>

                        <h:outputLabel value="Complemento" for="complemento"/>
                        <h:inputText value="#{FornecedorBean.complemento}" id="complemento" required="false" maxlength="40" style="width:330px;" requiredMessage="Campo Requerido."/>
                        <rich:message for="complemento" style="color:red;"/>

                        <h:outputLabel value="Tel. Comercial" for="telComercial"/>
                        <h:inputText value="#{FornecedorBean.telComercial}" id="telComercial" required="false" maxlength="14" style="width:80px;" requiredMessage="Campo Requerido."  styleClass="phone"/>
                        <rich:message for="telComercial" style="color:red;"/>

                        <h:outputLabel value="Tel. Celular" for="telCelular"/>
                        <h:inputText value="#{FornecedorBean.telCelular}" id="telCelular" required="false" maxlength="14" style="width:80px;" requiredMessage="Campo Requerido." styleClass="phone"/>
                        <rich:message for="telCelular" style="color:red;"/>

                        <h:outputLabel value="Tel. Fax" for="telFax"/>
                        <h:inputText value="#{FornecedorBean.telFax}" id="telFax" required="false" maxlength="14" style="width:80px;" requiredMessage="Campo Requerido." styleClass="phone"/>
                        <rich:message for="telFax" style="color:red;"/>

                    </h:panelGrid>
                    <br><br>
                    <a4j:commandButton value="Salvar" action="#{FornecedorBean.salvar}"/>&nbsp;&nbsp;
                    <a4j:commandButton value="Retornar" action="#{FornecedorBean.retornar}" immediate="true"/>&nbsp;&nbsp;
                </a4j:form>
            </rich:panel>

            <a4j:status id="modalStatus" onstart="Richfaces.showModalPanel('ajaxLoadingModalBox')"
            onstop="Richfaces.hideModalPanel('ajaxLoadingModalBox')" />
            <rich:modalPanel id="ajaxLoadingModalBox" zindex="20000" autosized="true">
                <h:outputText value="Carregando"/><br>
                <h:graphicImage value="../../_images/img_load.gif"/>
            </rich:modalPanel>
        </f:view>
    </body>
</html>